package prototype_mode

/**
原型模式
*/
type Cloneable interface {
	Clone() Cloneable
}

// CloneLab 克隆实验室
type CloneLab struct {
	car map[string]Cloneable
}

func GetCloneInstance() *CloneLab {
	return &CloneLab{car: make(map[string]Cloneable)}
}

//设置克隆对象属性
func (c *CloneLab) Set(name string, cloned Cloneable) {
	c.car[name] = cloned
}

//获取克隆对象
func (c *CloneLab) Get(name string) Cloneable {
	return c.car[name]
}
